package manager.action;

import java.util.List;

import org.apache.struts2.ServletActionContext;

import manager.dao.proxy.MessageDAOProxy;
import manager.vo.Message;
import manager.vo.User;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;

public class MessageAction extends ActionSupport implements ModelDriven<Message>{
	private static final long serialVersionUID = 1L;
    public Message message = new Message();
	@Override
	public Message getModel() {
		// TODO Auto-generated method stub
		return this.message;
	}
	public List<Message> list = null; 
	
	public List<Message> getList() {
		return list;
	}

	public void setList(List<Message> list) {
		this.list = list;
	}

	public String getMessage() throws Exception{
		Integer id = ((User)ServletActionContext.getRequest().getSession().getAttribute("user")).getId();
		list = MessageDAOProxy.getInstance().selectMessage(id);
		//System.out.println(list.get(0).toString());
		return "list";
	}

}
